package com.smart.util;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URISyntaxException;

import org.omg.CORBA.portable.InputStream;

import com.thoughtworks.xstream.core.util.Base64Encoder;

public class ImgEncode {
	String imgurl;
	public ImgEncode(String str){
		
		this.imgurl = str;
	}
	/*
	 * By:HH
	 * 
	 * @param:	imgurl
	 * 				图片路径
	 * @return:	String
	 * 				图片字节数组编码字符串
	 * */
	public static String getImgStr(String imgurl) throws IOException{
		
		FileInputStream in = null;
		byte[] data = null;
		in = new FileInputStream(imgurl);
		data = new byte[in.available()];
		in.read(data);
		in.close();
		Base64Encoder encoder = new Base64Encoder();
		return encoder.encode(data);
	}
}
